package com.sh.data.engine.domain.datadev.offline.service;

import com.sh.data.engine.domain.base.model.PageResult;
import com.sh.data.engine.domain.datadev.offline.model.domain.*;
import com.sh.data.engine.domain.datadev.offline.model.param.*;
import com.sh.data.engine.domain.workspace.manager.model.domain.UserDomain;
import com.sh.data.engine.repository.dao.datadev.entity.DatadevMenuNodeEntity;

import java.util.List;

/**
 * @Author: zigui.zdf @Date: 2022/2/21 11:12:05 @Description:
 */
public interface OfflineDevMenuNodeService {

    List<OfflineDevNodeDomain> getAllNodeByProjectId(Long pid, Long projectId);

    List<OfflineDevNodeDomain> getAllNodeByProjectIdAndPids(List<Long> pidList, Long projectId);

    Boolean deleteNode(
        Long id, Long projectId, boolean includeChildTask, boolean physicsDelete, Long taskFlowId);

    Boolean restoreNode(Long id, Long projectId);

    Boolean editNodeName(Long id, Long projectId, String name);

    Boolean clearAllNode(Long projectId);

    Boolean changeDir(Long id, Long pid, Long projectId);

    Boolean sortDir(Long id, Long siblingsId, Integer dropPosition, Long projectId);

    Boolean saveDir(Long id, Long pid, String name, Long projectId, String userId);

    List<OfflineDevDirTreeDomain> getDirTree(Long id, Long projectId);

    Boolean saveTask(OfflineDevTaskSaveParam param, Long projectId, String userId);

    Boolean saveResourceTask(OfflineDevTaskResourceSaveParam param, Long projectId, String userId);

    OfflineDevNodeDetailDomain getNodeDetail(Long id, Long projectId);

    Boolean lockTask(Long id, Long projectId, String userId, Integer isLock);

    Boolean saveTaskScript(
        Long id, Long projectId, String userId, String script, List<OfflineDevTaskScriptParam> params);

    OfflineDevTaskScriptDetailDomain getTaskScript(Long id, Long projectId);

    Boolean cloneTask(Long id, Long taskFlowNodeId, String newNodeName, Long projectId, String userId);

    PageResult<OfflineDevOperationHistoryDomain> getTaskOperationHistory(
        Long id, String content, Integer pageNum, Integer pageSize, Long projectId);

    OfflineDevTaskTableInfoDomain taskTableList(Long projectId);

    DatadevMenuNodeEntity saveTaskFlow(OfflineDevSaveTaskFlowParam param);

    OfflineDevTaskFlowDetailDomain getTaskFlowDetail(Long id, Long projectId);

    OfflineDevTaskFlowDetailDomain.Node saveTaskFlowNode(
        OfflineDevTaskFlowNodeSaveParam request, Long projectId, String userId);

    Boolean saveTaskFlowNodeRelation(
        Long taskFlowNodeId,
        Long upNodeId,
        Long downNodeId,
        Integer status,
        Long projectId,
        String userId);

    Boolean deleteTaskFlowNodeRelation(
        Long taskFlowNodeId, Long upNodeId, Long downNodeId, Long projectId, String userId);

    OfflineDevTaskFlowVNodeDetailDomain getTaskFlowVNodeDetail(Long nodeId, Long projectId);

    OfflineDevTaskFlowVNodeDetailDomain getNodeDetailByTaskFlowId(Long id, Long projectId);

    OfflineDevTaskPropertyDomain getTaskFlowNodeDetail(Long nodeId, Long projectId);

    Boolean saveTaskFlowVNodeConfig(Long nodeId, String remark, Long projectId, String userId);

    Boolean saveTaskFlowSchedule(
        OfflineDevTaskFlowVNodeConfigSaveParam param, Long projectId, String userId);

    Boolean saveTaskFlowNodeConfig(
        Long nodeId, String nodeName, String remark, Long projectId, String userId);

    List<OfflineDevTaskFlowDomain> getTaskFlowList(Long projectId);

    Boolean saveNodeCoord(OfflineDevSaveNodeCoordParam param, Long projectId, String userId);

    DatadevMenuNodeEntity findByXxlJobId(Integer xxlJobId);

    DatadevMenuNodeEntity findById(Long id);

    DatadevMenuNodeEntity findByIdAndProjectId(Long id, Long projectId);

    List<DatadevMenuNodeEntity> findByIdList(List<Long> idList);

    List<OfflineDevResourceDomain> listResourceTask(Long id, Long projectId);

    boolean dropResourceByIdAndName(Long id, String name, Long projectId);

    OfflineDevResourceDomain getResourceDetail(Long id, Long projectId);

    void saveOrUpdateOfflineSyncTask(OfflineDevSyncDomain offlineSyncDomain);

    OfflineDevSyncDomain getOfflineDevSyncDomainByNodeId(Long nodeId);

    List<OfflineDevResourceListDomain> getOfflineDevResourceList(Long projectId);

    void saveOrUpdateOfflineApiTask(OfflineDevApiDomain offlineDevApiDomain);

    OfflineDevApiDomain getOfflineDevApiDomainByNodeId(Long nodeId);

    boolean saveFunctionTask(OfflineDevFunctionSaveParam offlineDevFunctionSaveParam);

    boolean saveRule(
        OfflineDevDataQualityRuleParam dataqualityRule, Long projectId, UserDomain userDomain);

    OfflineDevDataQualityDetailDomain getRule(Long nodeId);

    OfflineDevFunctionDomain getOfflineDevFunctionDomain(Long nodeId);

    Boolean saveWorkTask(OfflineDevTaskSaveParam param, Long projectId, String userId);

    List<OfflineDevNodeDomain> getUntilNodeType(Long projectId, Integer nodeType);

    DatadevMenuNodeEntity getTaskFlowVnodeByTaskFlowId(Long taskFlowId, Long projectId);

    boolean setTaskFlowScheduleStatus(Long taskFlowNodeId, Integer status);

    List<OfflineDevNodeDomain> getAllTaskFlowList(Long projectId);

    List<OfflineDevNodeDomain> getAllPublishedTaskFlowList(Long projectId);

    Long getIdByNamePid(String name, Long pid);

    List<OfflineDevNodeDomain> getNodeListByIds(List<Long> idList, Long projectId);

    Long getParentTypeByNodeId(Long nodeId);

    OfflineDevToolsDomain getDevToolList(Long projectId);


    DatadevMenuNodeEntity getVnodeByTaskFlowNodeId(Long taskFlowNodeId);

    List<DatadevMenuNodeEntity> getListByPage(Long projectId, Integer pageSize, Integer pageNum);

    void saveXxlJobByTaskFlowId(Long vNodeId);

    List<OfflineDevNodeDomain> getDatadevList(Long projectId, Long dirId);


    List<DatadevMenuNodeEntity> getWorkFlowByProjectId(Long projectId);

    List<String> getNodeTableById(Long jobId);
}
